package com.shiguiwu.springmybatis.algorithm.queue;

import java.util.Scanner;

/**
 * @description:
 * @author: stone
 * @date: Created by 2021/2/27 22:41
 * @version: 1.0.0
 * @pakeage: com.shiguiwu.springmybatis.queue
 */
public class ArrayQueueTests {

    public static void main(String[] args) {
        System.out.println("输入a调用addQueue()方法");
        System.out.println("输入g调用getQueue()方法");
        System.out.println("输入h调用addQueue()方法");
        System.out.println("输入a调用addQueue()方法");

        Scanner scanner = new Scanner(System.in);
        ArrayQueue queue = new ArrayQueue(scanner.nextInt());
        boolean loop = true;
        while (loop) {
            String res = scanner.next();
            switch (res) {
                case "a" :
                    queue.addQueue(scanner.nextInt());
                    break;
                case "g":
                    int queue1 = queue.getQueue();
                    System.out.println("出队的元素是：" + queue1);
                    break;
                case "h":
                    int i = queue.headQueue();
                    System.out.println("获取头队列：" + i);
                    break;
                case "p":
                    System.out.println("如下打印数组是：");
                    queue.print();
                    break;
                default:
                    System.out.println("程序终止》》》》》");
                    loop = false;
                    break;
            }
        }

    }
}
